<template>
  <!-- <slot name="item-img"></slot>
    <slot name=item-text></slot> -->
  <div class="tab-bar-one" @click="btn">
    <div v-if="!isActive"><slot name="item-img"></slot></div>
    <div v-else><slot name="item-img-active"></slot></div>
    <div :style="isColorActive"><slot name="item-text"></slot></div>
  </div>
</template>

<script>
export default {
  name: "Tabbaritem",
  props: {
    path: String,
    isColor: {
      type: String,
      default: "red",
    },
  },
  data() {
    return {
      // isActive: true,
    };
  },
  computed: {
    isActive() {
      return this.$route.path.indexOf(this.path) !== -1;
    },
    isColorActive() {
      return this.isActive ? { color: this.isColor } : {};
    },
  },
  methods: {
    btn() {
      this.$router.replace(this.path);
    },
  },
};
</script>

<style>
.tab-bar-one {
  font-size: 14px;
  flex: 1;
  background-color: #ffffff;
}
.tab-bar-one img {
  width: 24px;
  height: 24px;
  margin-top: 5px;
  vertical-align: middle;
}
/* .active {
  color: #ff5777;
} */
</style>